#!/usr/bin/env python
#Nz9fZ2VT4Sh8

import roslib; roslib.load_manifest('people_recognition')
import rospy, sys, actionlib
from storage.msg import *

def findImages(personID):
	database = actionlib.SimpleActionClient("addPerson",addPersonAction)
	database.wait_for_server()
	imageList = []
	goal=addPersonGoal()
	goal.target.append("get")
	goal.target.append("mainBio")
	database.send_goal(goal)
	database.wait_for_result()
	res = database.get_result()
	for i in range(len(res.result)):
		values = res.result[i].split(",")
		if(int(values[2]) is personID):
			imageList.append(values[1])
	rospy.logwarn(imageList)
				
		

if __name__ == '__main__':
	rospy.logwarn('Starting Image Lister...')
	rospy.init_node('image_lister')
	args = sys.argv
	if len(args) != 2:
		rospy.logwarn("Invalid number of arguments!")
	else:
		personID = int(args[1])
		findImages(personID)
